Answer:

1
2
3

Three Steps of a LET Statement

A LET statement can do quite a bit of work. You have seen examples of this already. Consider this statement:

LET SUM = A + 23.

Here is a summary of what can happen:

A LET Statement

  1. Finds memory for each new variable in the statement. A zero will be placed in numeric variables if there is no other information. (If there are no new variables, this step does nothing.)
  2. Does the calculation on the right of the equal sign. (If there is nothing to calculate, it just uses the value that is there.)
  3. Replaces the contents of the variable to the left of the equal sign with the result of the calculation.

The calculation on the right of the equal sign is carried out just as for any arithmetic expression. To get that value you can (temporarily) forget that it is part of a LET statement.

Once a value is "in hand" it replaces the contents of the variable to the left of the equal sign. There should only be one variable there.

QUESTION 24:

What does the following program print?

' LET example
'
LET A = 2
LET B = 4
LET C = (A + B) / 2
PRINT A, B, C
END